package dao;

import model.Game;

import java.util.List;

import org.hibernate.criterion.Order;

/**
 * User: gutnikov
 * Date: 09.09.2010
 */
public class GameDaoImpl extends HibernateDaoImpl<Game> implements GameDao{

	public List<Game> getMostRated(String genre, Integer count, Integer offset) {
		List<Game> gl = createCriteria().addOrder(Order.desc("rating")).addOrder(Order.desc("plays")).list();
		return gl.subList(Math.min(offset,gl.size()),Math.min(offset + count,gl.size()));		
	}
}
